<body <?php if (count($this->params->events) > 0): ?> <?php foreach(array_keys($this->params->events) as $event_name):?><?php echo $event_name; ?>="call_<?php echo $event_name; ?>()" <?php endforeach;?><?php endif;?>>

<?php if (count($this->params->events) > 0): ?>
<script type="text/javascript">

	<?php foreach($this->params->events as $event_name => $event_code):?>
	function call_<?php echo $event_name; ?>()
	{
		<?php foreach($event_code as $line): ?>
		<?php echo $line; ?>
		<?php endforeach; ?>
	}
	<?php endforeach; ?>
	
</script>
<?php endif;?>

<script type="text/javascript">
	
	var puzzle = new Array();
	puzzle["base_url"] = "<?php echo $this->puzzle->config["base_url"]; ?>";
	
</script>

<?php $this->params->view_content->render(); ?>

</body>
